function ajaxonload()
{
	////////////////////////
	// mouse event
	var ison=false;
	$("img.thumbnail")
	.hover(
	function()
	{
		//$(this).removeClass("thumbnail").addClass("normalsize");
	},
	function()
	{
		//$(this).removeClass("normalsize").addClass("thumbnail");
	});
	
	////////////////////////
	// search button event
	_search_opt=$("#sel_search_opt").val();
	$("#bt_search")
	.click(
	function()
	{
		<%=_func%>('0', '<%=_howmany%>','<%=_orderby%>', '<%=_orderbytype%>', $('#sel_search_opt').val(), $("#input_search_word").val(), '<%=_viewtype%>'); 
	});
	$("#input_search_word")
	.keydown(
	function(event)
	{
		if(event.keyCode==13)
			<%=_func%>('0', '<%=_howmany%>','<%=_orderby%>', '<%=_orderbytype%>', $('#sel_search_opt').val(), $("#input_search_word").val(), '<%=_viewtype%>');
	});
	
	////////////////////////
	//current items/page
	$("#sel_howmany").val('<%=_howmany%>');
	$("#sel_howmany").change(
	function()
	{
		<%=_func%>(($(this).val()<<%=maximum%>)?'<%=_startfrom%>':'0', $(this).val(),'<%=_orderby%>', '<%=_orderbytype%>', '<%=_search_opt%>', '<%=_search_word%>', '<%=_viewtype%>'); 
	});
	
	////////////////////////
	//fill up status updates, repeatedly
	//callupdateme();
	callupdateme2("#tbl_contentsdesc", "div.pubcommand");
	callupdateme2("#div_contentsdesc", "div.pubcommand");
}

function callupdateme2(_from, _which)
{
	var i=0;
	//var $divs = $("#tbl_contentsdesc > tbody > tr > td > div.test");
	var $divs = $(_from).find(_which);
	for(i=0; i<$divs.length; i++)
	{
		var $cur = $divs.eq(i);
		//$cur.html("<div style=\"display:none\">"+$cur.html()+"</div>"+"<img src='../design/img/loading.gif' class='loadinggif' style=\"width: 20px; height: 20px; position:inherit;\"/>");
		
		var $frm = $cur.find("form:first");
		$frm
		.html("<input type=\"hidden\" name=\"_donotupdate\" value=\"1\"/>" + $frm.html())
		.ajaxSubmit({target:'#'+$cur.attr('id')});
	}
	//setTimeout("callupdateme2()", 10000);
}

function lockcontrols(_obj)
{
	$(_obj).find("a").attr("disabled", "disabled");
	$(_obj).find("input").attr("disabled", "disabled");
	$(_obj).find("select").attr("disabled", "disabled");
}
function unlockcontrols(_obj)
{
	$(_obj).find("a").attr("disabled", "");
	$(_obj).find("input").attr("disabled", "");
	$(_obj).find("select").attr("disabled", "");
}

function callupdateme()
{
	lockcontrols("#div_contentsdesc");
	updateme($("#tbl_contentsdesc > tbody > tr > td > div.test"), 0);	
}
function updateme($divs, who)
{
	if($divs.length!=0)
	{
		$cur = $divs.eq(who);
		var _status = $cur.find("#_status:first").val();
			
		$cur.html($("#div_nowloading").html());
		$.ajax(
		{
			type: "POST",
			url: "/CANSSWebService/svtAjaxContentStatusUpdate",
			data:
			{
				_cid: $cur.attr('id').replace("div_", ""),
				_ajax: '<%=_admin%>',
				_status: _status,
				_rurl: '<%=_rurl%>',
				_donotupdate: '1'
			},
			success:
			function(msg)
			{
				$cur.html(msg);
				if((who+1)<$divs.length)
					updateme($divs, (who+1));
				else
				{
					unlockcontrols("#div_contentsdesc");
				}
			}
		});
	}else
		unlockcontrols("#div_contentsdesc");
}
function see_contentsdesc_detail(_cid, _div)
{
	$.ajax({
  type: "POST",
  url: "components/contentsdesc_detail.jsp",
  data: {
  				_cid:_cid,
  				_div:_div
  			},
  success: function(msg){
    $(_div).html(msg);
    $(_div).show('slide');
  }
  });
}